package com.gzsxy.esjy.redis.extend.impl;

/**
 * @author xiaolong
 * @version 1.0
 * @description: 锁定义
 * @date 2021/12/28 14:36
 */
public class Lock {

    private final String key;
    private String group = "default";
    private long maxWaitTime = 1000L;
    private long timeInterval = 2L;
    private String failMsg = "当前系统繁忙，请重新请求";


    public Lock(String key, String group, long maxWaitTime, long timeInterval) {
        this.key = key;
        this.group = group;
        this.maxWaitTime = maxWaitTime;
        this.timeInterval = timeInterval;
    }

    public Lock(String key) {
        this.key = key;
    }

    public Lock(String key, String group) {
        this.key = key;
        this.group = group;
    }

    public Lock(String key, String group, long maxWaitTime, long timeInterval, String failMsg) {
        this.key = key;
        this.group = group;
        this.maxWaitTime = maxWaitTime;
        this.timeInterval = timeInterval;
        this.failMsg = failMsg;
    }


    public String getKey() {
        return this.key;
    }

    public String getGroup() {
        return this.group;
    }


    public long getMaxWaitTime() {
        return this.maxWaitTime;
    }

    public Lock setMaxWaitTime(long maxWaitTime) {
        this.maxWaitTime = maxWaitTime;
        return this;
    }

    public long getTimeInterval() {
        return this.timeInterval;
    }

    public Lock setTimeInterval(long timeInterval) {
        this.timeInterval = timeInterval;
        return this;
    }

    public String getFailMsg() {
        return this.failMsg;
    }

    public Lock setFailMsg(String failMsg) {
        this.failMsg = failMsg;
        return this;
    }
}
